Skip to content

Launch-readiness fixes: generic port detection + clean pm2-missing state#27

Merged
fredrivett merged 2 commits into
mainfrom
claude/reeve-sidetrack-launch-review-hk85kf
Jun 26, 2026
Merged

Launch-readiness fixes: generic port detection + clean pm2-missing state#27
fredrivett merged 2 commits into
mainfrom
claude/reeve-sidetrack-launch-review-hk85kf

Conversation

@fredrivett

@fredrivett fredrivett commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

A deep-dive review of the codebase against the reeve launch checklist (Sidetrack project RVE), focused on the pre-launch QA items (RVE-11: sanity-check empty/error/edge states). Two issues stood out as worth fixing before a public OSS launch; both are small and well-contained.

1. Generalise pm2 port detection (RVE-11)

Port detection hardcoded a project-specific GPTZERO_CUSTOM_PORT env var — a company-internal name that has no place in a general-purpose, public tool. It's now a generic rule: read the bare PORT or any *_PORT variable (SERVER_PORT, HTTP_PORT, …), preferring a specific *_PORT over the generic PORT and breaking ties alphabetically for deterministic results regardless of JSON key order.

  • Existing setups that used GPTZERO_CUSTOM_PORT keep working (it ends in _PORT), and detection now covers everyone else's conventions too.
  • To find these without modelling the whole (secret-bearing) pm2_env, the decoder enumerates env key names but only decodes the values of port-shaped keys — secret values still never enter memory.
  • Keys that merely contain "port" (SUPPORT_EMAIL, EXPORT_DIR) are ignored; a non-numeric value falls through to the next candidate.
  • Port-extraction tests updated to cover the generalised behaviour.

2. Clean error state when pm2 isn't installed (RVE-11)

When the pm2 binary couldn't be resolved (e.g. pm2 not installed — a very common first-run state for new users from a launch), refresh() set the error message but returned before marking the first scan complete. The UI then showed the error banner and the loading skeleton shimmering forever beneath it. Now the first scan is marked complete on resolver failure, so the panel settles into a clean error-only state.

Testing

  • No Swift toolchain in this Linux environment, so the macos-15 CI (swiftlint --strict, swift build, swift test) is the source of truth. Logic and Codable usage reviewed by hand.

Notes for the rest of the checklist

The remaining open launch items are human-owned and out of scope for a code PR: final/draft launch copy (RVE-7/8/9/15/16), the fresh-install test on a clean Mac (RVE-10), and bumping to v1.0.0 (RVE-12). The stale VERSION file (0.1.0) noted in RVE-12 is only a fallback in build-release.sh; the release workflow always passes the git tag, so I left it for the release step.

🤖 Generated with Claude Code


Generated by Claude Code


Summary by cubic

Generalizes pm2 port detection and fixes the endless loading skeleton when pm2 isn’t installed. Improves launch readiness and covers RVE-11 sanity checks for empty/error/edge states.

  • New Features

    • Detect port from args, then *_PORT or PORT; *_PORT wins, ties sorted alphabetically for deterministic results.
    • Only scan env key names and decode port-shaped values; ignore non-port keys and non-numeric values. Backward compatible with GPTZERO_CUSTOM_PORT. Tests updated.
  • Bug Fixes

    • When pm2 can’t be resolved, mark the first scan complete so the UI shows a clean error state instead of a forever-loading skeleton.

Written for commit ed218c1. Summary will update on new commits.

Review in cubic

claude added 2 commits June 25, 2026 17:15
Port detection hardcoded a project-specific GPTZERO_CUSTOM_PORT env var,
which has no place in a general-purpose, public tool. Replace it with a
generic rule: read the bare PORT or any *_PORT variable (e.g. SERVER_PORT,
HTTP_PORT), preferring a specific *_PORT over the generic PORT and breaking
ties alphabetically so the result is deterministic regardless of JSON key
order.

To find these without modelling the whole (secret-bearing) pm2_env, the
decoder enumerates env key names but only decodes the values of port-shaped
keys, so secret values still never enter memory. Keys that merely contain
"port" (SUPPORT_EMAIL, EXPORT_DIR) are ignored, and a non-numeric value
falls through to the next candidate.

Update the port-extraction tests to cover the generalised behaviour.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fGGnRAjpLH5EWXNaqYza8
When the pm2 binary can't be resolved (e.g. pm2 isn't installed), refresh()
set the error message but returned before marking the first scan complete.
The UI then showed the error banner together with the loading skeleton
shimmering forever beneath it — a broken-looking first run for anyone
without pm2.

Mark the first scan complete on resolver failure so the panel settles into
a clean error state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fGGnRAjpLH5EWXNaqYza8

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@fredrivett fredrivett merged commit 0605828 into main Jun 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants